import * as fs from "fs";
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import vue from "@vitejs/plugin-vue";
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        VitePWA({
            registerType: "autoUpdate",
            manifest: {
                name: "iKP Image Service",
                short_name: "iis",
                start_url: ".",
            },
        }),
    ],
    server: {
        // https: {
        //     key: fs.readFileSync(".ssh/server.local.key"),
        //     cert: fs.readFileSync(".ssh/server.local.crt"),
        // },
        port: 3000,
        host: "0.0.0.0",
        cors: true,
        // 反向代理
        proxy: {
            '/predict': {
                target: 'http://10.206.1.205:8866',
                changeOrigin: true,
                // rewrite: path => path.replace(/predict/, '')
            }
        },
       
    },
});
